package com.xiaohong;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * 引导类，用于自动配置和扫描
 */

//@EnableAutoConfiguration   //启用自动配置
//@ComponentScan  //不指定值，这自动扫描本类下所有的包，这里扫描com.xiaohong下的所有包及其子包，开发时一般指定值
@SpringBootApplication  //组合注解，包含了@EnableAutoConfiguration @ComponentScan @SpringBootConfiguration注解，简化注解声明 只会扫描同级的包
public class TestApplication {

    public static void main(String[] args) {
        // 获取当前容器的上下文
        ConfigurableApplicationContext configurableApplicationContext = SpringApplication.run(TestApplication.class, args);
        Object helloController = configurableApplicationContext.getBean("helloController");
        System.out.println(helloController);
    }

}
